package com.jr.controller;

import com.google.gson.Gson;
import com.jr.entity.EAttention;
import com.jr.service.EAttentionService;
import com.jr.service.EnterpriseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class EAttentionController {
    @Autowired
    private EAttentionService eAttentionService;
    /**
     * 查询企业是否被用户关注
     */
    @RequestMapping(value = "selectEAttentionWithUser.do", produces = "text/html;charset=utf-8")
    public @ResponseBody String  selectEAttentionWithUser(EAttention eAttention) {
        System.out.println(eAttention);
        EAttention eAttention1 = eAttentionService.selectEAttentionWithUser(eAttention);
        System.out.println(eAttention1);
        return new Gson().toJson(eAttention1);
    }
    /**
     * 给用户添加企业关注
     */
    @RequestMapping(value = "addEAttentionWithUser.do", produces = "text/html;charset=utf-8")
    public @ResponseBody String addEAttentionWithUser(EAttention eAttention) {
        int i = eAttentionService.addEAttentionWithUser(eAttention);
        return new Gson().toJson(i);
    }
    /**
     * 删除用户与企业的关注信息
     */
    @RequestMapping(value = "deleteEAttentionWithUser.do", produces = "text/html;charset=utf-8")
    public @ResponseBody String deleteEAttentionWithUser(EAttention eAttention) {
        int i = eAttentionService.deleteEAttentionWithUser(eAttention);
        return new Gson().toJson(i);
    }

}
